const path = require("path");
const webpack = require("webpack");

let externals = _externals();


module.exports = {
  entry: path.resolve(__dirname, "index.js"),
  mode: "production",
  target: "node",
  output: {
    filename: "server.js",
    path: path.resolve(__dirname, "dist"),
  },
  resolve: {
    extensions: ["", ".js"],
  },
  externals: externals,
};


function _externals() {
  let manifest = require("./package.json");
  let dependencies = manifest.dependencies;
  let externals = {};
  for (let p in dependencies) {
    externals[p] = "commonjs " + p;
  }
  return externals;
}
